module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;
  const RoleSchema = new Schema({
    "__thingName__": {
      "type": "String"
    },
    "__deviceId__": {
      "type": "String"
    },
    "Estop": {
      "type": "Boolean"
    },
    "__logicalInterfaceId__": {
      "type": "String"
    },
    "Plastic": {
      "type": "Number"
    },
    "Metal": {
      "type": "Number"
    },
    "StartState": {
      "type": "Boolean"
    },
    "_Timestamp": {
      "type": "Number"
    },
    "Total_gl": {
      "type": "Number"
    },
    "wz_velocity": {
      "type": "Number"
    },
    "__assetId__": {
      "type": "String"
    },
    "DurationShutdown": {
      "type": "Number"
    },
    "__deviceTypeId__": {
      "type": "String"
    },
    "qd001": {
      "type": "Boolean"
    },
    "RunningDuration": {
      "type": "Number"
    },
    "from": {
      "type": "String"
    },
    "__cloud_time__": {
      "type": "Number"
    },
    "MotorTemperature": {
      "type": "Number"
    },
    "WorkingStatus": {
      "type": "Number"
    },
    "ResetState": {
      "type": "Boolean"
    },
    "MotorSpeed": {
      "type": "Number"
    },
    "MotorStart": {
      "type": "Number"
    },
    "estop": {
      "type": "Number"
    },
    "__modelType__": {
      "type": "String"
    },
    "__metricsType__": {
      "type": "Number"
    },
    "__tenantId__": {
      "type": "ObjectId"
    },
    "__calculate_time__": {
      "type": "Number"
    },
    "wz_displacement": {
      "type": "Number"
    },
    "__online__": {
      "connected": {
        "type": "Boolean"
      }
    },
    "DurationInstant": {
      "type": "Number"
    },
    "tz001": {
      "type": "Boolean"
    },
    "__physicalInterfaceId__": {
      "type": "String"
    },
    "__create_time__": {
      "type": "Number"
    },
    "CoderData": {
      "type": "Number"
    },
    "__deptScope__": {
      "type": "String"
    },
    "Estop_Count": {
      "type": "Number"
    },
    "Total": {
      "type": "Number"
    },
    "Production_HH": {
      "type": "Number"
    },
    "__timestamp__": {
      "type": "Number"
    },
    "wz_temperature": {
      "type": "Number"
    },
    "updatetime": {
      "type": "String"
    },
    "StopState": {
      "type": "Boolean"
    },
    "Monitor": {
      "type": "Boolean"
    },
    "Wz_addSPeed": {
      "type": "Number"
    }
  });
  return mongoose.model("Device", RoleSchema, "device");
};
